package com.itlong.cloud.POJO.VO.app;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang.StringUtils;

import java.io.Serializable;

/**
 * <desc>
 *      APP外呼设备信息VO类
 * </desc>
 *
 * @createDate 2020/05/07
 */
@Data
@NoArgsConstructor
public class AppOutCallDeviceVO implements Serializable, Comparable<AppOutCallDeviceVO> {

    private String deviceName;          //设备名称
    private String deviceUnique;        //设备唯一码
    private String projectId;           //项目编号
    private String cardNum;              //软卡号
    private String valiTime;             //有效时间
    private String threshold;           //开门阈值
    private String bindFloor;           //蓝牙外呼设备绑定楼层，多个，号分隔
    private String position;             //排序值
    private String floorDeviceUnique;             //绑定的电梯，用“,”隔开
    private String bindFloorName;             //蓝牙外呼设备绑定楼层名称，多个，号分隔

    /**
     * <desc>
     *      排序重写方法
     * </desc>
     *
     * @author wangzhi
     * @createDate 2020/05/07
     */
    @Override
    public int compareTo(AppOutCallDeviceVO o) {
        if (o == null) {
            return 1;
        }
        if (StringUtils.isNotBlank(this.getPosition()) && StringUtils.isNotBlank(o.getPosition())) {
            if (Integer.valueOf(this.getPosition()) > Integer.valueOf(o.getPosition())) {
                return 1;
            } else {
                return -1;
            }
        }
        if (StringUtils.isBlank(this.getPosition()) && StringUtils.isBlank(o.getPosition())) {
            return -1;
        } else if (StringUtils.isNotBlank(o.getPosition())) {
            return 1;
        } else {
            return -1;
        }
    }

}
